﻿@model IEnumerable<SAKS.Models.PictureInfo>
@{
    
    ViewBag.Title = "Picture";
    Layout = "~/Views/Project/_FilesLayout.cshtml";
}

<script type="text/javascript">
    $(function () {    
        $("#uploadimage").button();
        $("img.thumbnail").click(function () {
            loadImage($(this).attr("id"));
        });
    });
    function loadImage(id) {
        var cover = $("#modal-cover");
        var loader = $("#loader");
        if (cover.length == 0) {//如果cover不存在则创建它
            var _cover = document.createElement("div");
            _cover.setAttribute("id", "modal-cover");
            document.body.appendChild(_cover);
            cover = $(_cover);
            cover.click(function () { $(this).hide(); $("#loader").hide(); });
            var _loader = document.createElement("div");
            _loader.setAttribute("id", "loader");
            document.body.appendChild(_loader);
            loader = $(_loader);
            loader.click(function () { $(this).hide(); $("#modal-cover").hide(); });
        }
        cover.addClass("processing-big");
        cover.show();
        loader.empty();        
        var img = new Image();
        $(img).load(function () {
            cover.removeClass("processing-big");
            $("#loader").append(this);
            loader.css({ top: ($(document).height() - img.height) / 2, left: ($(document).width() - img.width) / 2 });
            loader.show();
        }).error(function () {
        }).attr('src', "/Picture/Original/" + id);
    }
    window.onscroll = function () {
        var cover = document.getElementById("modal-cover");
        if (cover != null) {
            var top = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
            var left = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
            $(cover).css({ top: top.toString() + "px", left: left.toString() + "px" });
        }
    }
</script>


<div class="col_header">
    <div class="uploader">
        <a href="/Project/UploadPicture/@ViewBag.ProjectId" class="white" id="uploadimage">上传图片</a>
    </div>
</div>
<hr />
<div>
@if (Model.Count() != 0)
{
    foreach (var m in Model)
    {
    <div class="infolist">
        <div class="imageholder"><a href="#"><img id="@m.PictureId" class="thumbnail" src="/Picture/Thumbnail/@m.PictureId" alt="缩略图"/></a></div>     
        <table class="pictable">
            <tr>
                <td ><span class="strong">图件名称：</span>@m.Name</td>              
            </tr>
            <tr>
                <td ><span class="strong">图件编号：</span>@m.SerialNumber</td>
                <td ><span class="strong">安全级别：</span>@m.SecurityLevel</td>            
            </tr>
            <tr>
                <td ><span class="strong">提供单位：</span>@m.ProvideOrganization</td>
                <td ><span class="strong">审核人：</span>@m.Checker</td>

            </tr>
            <tr>
                <td ><span class="strong">图号：</span>@m.PictureNumber</td>
                <td ><span class="strong">备注：</span>@m.Remarks</td>
            </tr>
        </table>      
    </div>    
    <hr />
    }
}
else
{ 
    <div class="infolist">没有图件</div>
    <hr />
}
</div>


<div class="pagelink test clear">
    <ul>                      
        @if (ViewBag.PrePage == -1)
        {                     
        <li><span title="没有了">上一页</span></li>     
        }
        else
        { 
        <li><a href="/Project/PictureList?id=@ViewBag.ProjectId&page=@ViewBag.PrePage">上一页</a></li>  
        } 
        @if (ViewBag.NextPage == -1)
        {                     
        <li><span title="没有了">下一页</span></li>    
        }
        else
        { 
        <li><a href="/Project/PictureList?id=@ViewBag.ProjectId&page=@ViewBag.NextPage">下一页</a></li> 
        }                 
    </ul>
</div>

